<template>
    <a-modal class="preview-img-mod" width="80%" :visible="previewVisible" :footer="null"
        :dialog-style="{ top: '20px' }" @cancel="close">
        <div slot="closeIcon" slot-scope="props" class="close-icon">
            <a-icon type="close" />
        </div>
        <a-carousel v-if="previewVisible" draggable arrows>
            <div slot="prevArrow" slot-scope="props" class="custom-slick-arrow" style="left: 10px;zIndex: 1">
                <a-icon type="left-circle" />
            </div>
            <div slot="nextArrow" slot-scope="props" class="custom-slick-arrow" style="right: 10px">
                <a-icon type="right-circle" />
            </div>
            <div class="preview-image-box" v-for="(image, index) in imgList" :key="index">
                <img :src="image" alt="image" class="preview-image"  />
            </div>
            

        </a-carousel>
    </a-modal>
</template>
<script>
export default {
    name: "previewImage",
    props: ["previewVisible","imgList"],
    methods:{
        close(){
            this.$emit('close')
        }
    }
};
</script>
<style lang="scss">
.preview-img-mod {
    .ant-modal-content{
        box-shadow: unset;
    }
    .ant-carousel .slick-track{
        display: flex;
        align-items: center;

    }
    .close-icon {
        color: #fff;
        font-size: 28px;
    }
    .ant-modal-content {
        background-color: transparent;
    }

    .ant-carousel .slick-slide {
        text-align: center;
        overflow: hidden;
    }

    .ant-carousel .custom-slick-arrow {
        width: 30px;
        height: 30px;
        font-size: 30px;
        color: #fff;
        background-color: rgba(31, 45, 61, 0.11);
        opacity: 0.5;
    }
    .ant-carousel .custom-slick-arrow:before {
        display: none;
    }
    .ant-carousel .custom-slick-arrow:hover {
        opacity: 0.5;
    }
    .preview-image-box{
        text-align: center;
    }
    .preview-image{
        max-width: 80%;
        max-height: 80vh;
        border-radius: 10px;
        display: inline-block !important;
    }
}
</style>